<?php
declare (strict_types=1);

namespace app\admin\controller\user;

use think\response\Json;
use app\admin\controller\Controller;
use app\admin\model\user\PointsLog as PointsLogModel;
use app\common\enum\user\pointsLog\Scene as SceneEnum;
/**
 * 积分明细
 * Class Points
 * @package app\admin\controller\user
 */
class Points extends Controller
{
    /**
     * 积分明细
     * @return Json
     */
    public function log(): Json
    {
        $model = new PointsLogModel;
        $list = $model->getList($this->request->param())->toArray();
        return $this->renderSuccess([
            'total' => $list['total'],
            'items' => $list['data']
        ]);
    }
    /**
     * 变动场景
     * @return Json
     */
    public function getScene(): Json
    {
        $list = SceneEnum::data();
        $res = [];
        foreach ($list as $key => $value) {
            $res[] = $value;
        }
        return $this->renderSuccess($res);
    }
}
